function initPage(examId){
    ajaxCall("POST",path+"/SelfExamTransactionServlet?method=searchAnswer&examId="+examId,getAnswer);
}
function getAnswer(res) {
    var obj = JSON.parse(res);
    if(obj==null){
        alert("你今天没有提交作业哟！！");
    } else{
        for(var i in obj) {
            var accordion = document.getElementById("accordion");
            if(i==0){
                accordion.innerHTML += "<div class='panel panel-default'>" +
                    "<div class='panel-heading'><h4 class='panel-title'><a data-toggle='collapse' data-parent='#accordion' href='#collapse"+i+"'>"
                    + obj[i].name + "</a></h4></div>" + "<div id='collapse"+i+"' class='panel-collapse collapse in'>" +
                    " <div class='panel-body'>" + obj[i].answer + "</div> </div></div>";
            }else{accordion.innerHTML +="<div class='panel panel-default'>"+
                "<div class='panel-heading'><h4 class='panel-title'><a data-toggle='collapse' data-parent='#accordion' href='#collapse"+i+"'>"
                +obj[i].name+"</a></h4></div>"+"<div id='collapse"+i+"' class='panel-collapse collapse'>"+
                "<div class='panel-body'>"+ obj[i].answer +"</div> </div></div>";
            }
        }
    }
}
